<?php
/**
 * CreativePreviewConfiguration
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Amazon Ads API for Sponsored Display
 *
 * This API enables programmatic access for campaign creation, management, and reporting for Sponsored Display campaigns. For more information on the functionality, see the [Sponsored Display Support Center](https://advertising.amazon.com/help#GTPPHE6RAWC2C4LZ). For API onboarding information, see the [account setup](https://advertising.amazon.com/API/docs/en-us/guides/onboarding/overview) topic.<br/><br/> > This specification is available for download from the **[Advertising API developer portal](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/sponsored-display/3-0/openapi.yaml).**
 *
 * OpenAPI spec version: 3.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * CreativePreviewConfiguration Class Doc Comment
 *
 * @category Class
 * @description Optional configuration for creative preview.
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class CreativePreviewConfiguration implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'CreativePreviewConfiguration';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'size' => '\AmazonAdvertisingApi\Model\CreativePreviewConfigurationSize',
        'products' => '\AmazonAdvertisingApi\Model\CreativePreviewConfigurationProducts[]',
        'landing_page_url' => '\AmazonAdvertisingApi\Model\LandingPageURL',
        'landing_page_type' => '\AmazonAdvertisingApi\Model\LandingPageType',
        'ad_name' => '\AmazonAdvertisingApi\Model\AdName',
        'is_mobile' => 'bool',
        'is_on_amazon' => 'bool'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'size' => null,
        'products' => null,
        'landing_page_url' => null,
        'landing_page_type' => null,
        'ad_name' => null,
        'is_mobile' => null,
        'is_on_amazon' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'size' => 'size',
        'products' => 'products',
        'landing_page_url' => 'landingPageURL',
        'landing_page_type' => 'landingPageType',
        'ad_name' => 'adName',
        'is_mobile' => 'isMobile',
        'is_on_amazon' => 'isOnAmazon'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'size' => 'setSize',
        'products' => 'setProducts',
        'landing_page_url' => 'setLandingPageUrl',
        'landing_page_type' => 'setLandingPageType',
        'ad_name' => 'setAdName',
        'is_mobile' => 'setIsMobile',
        'is_on_amazon' => 'setIsOnAmazon'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'size' => 'getSize',
        'products' => 'getProducts',
        'landing_page_url' => 'getLandingPageUrl',
        'landing_page_type' => 'getLandingPageType',
        'ad_name' => 'getAdName',
        'is_mobile' => 'getIsMobile',
        'is_on_amazon' => 'getIsOnAmazon'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }



    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['size'] = isset($data['size']) ? $data['size'] : null;
        $this->container['products'] = isset($data['products']) ? $data['products'] : null;
        $this->container['landing_page_url'] = isset($data['landing_page_url']) ? $data['landing_page_url'] : null;
        $this->container['landing_page_type'] = isset($data['landing_page_type']) ? $data['landing_page_type'] : null;
        $this->container['ad_name'] = isset($data['ad_name']) ? $data['ad_name'] : null;
        $this->container['is_mobile'] = isset($data['is_mobile']) ? $data['is_mobile'] : null;
        $this->container['is_on_amazon'] = isset($data['is_on_amazon']) ? $data['is_on_amazon'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets size
     *
     * @return \AmazonAdvertisingApi\Model\CreativePreviewConfigurationSize
     */
    public function getSize()
    {
        return $this->container['size'];
    }

    /**
     * Sets size
     *
     * @param \AmazonAdvertisingApi\Model\CreativePreviewConfigurationSize $size size
     *
     * @return $this
     */
    public function setSize($size)
    {
        $this->container['size'] = $size;

        return $this;
    }

    /**
     * Gets products
     *
     * @return \AmazonAdvertisingApi\Model\CreativePreviewConfigurationProducts[]
     */
    public function getProducts()
    {
        return $this->container['products'];
    }

    /**
     * Sets products
     *
     * @param \AmazonAdvertisingApi\Model\CreativePreviewConfigurationProducts[] $products The products to preview. Currently only the first product is previewable.
     *
     * @return $this
     */
    public function setProducts($products)
    {
        $this->container['products'] = $products;

        return $this;
    }

    /**
     * Gets landing_page_url
     *
     * @return \AmazonAdvertisingApi\Model\LandingPageURL
     */
    public function getLandingPageUrl()
    {
        return $this->container['landing_page_url'];
    }

    /**
     * Sets landing_page_url
     *
     * @param \AmazonAdvertisingApi\Model\LandingPageURL $landing_page_url landing_page_url
     *
     * @return $this
     */
    public function setLandingPageUrl($landing_page_url)
    {
        $this->container['landing_page_url'] = $landing_page_url;

        return $this;
    }

    /**
     * Gets landing_page_type
     *
     * @return \AmazonAdvertisingApi\Model\LandingPageType
     */
    public function getLandingPageType()
    {
        return $this->container['landing_page_type'];
    }

    /**
     * Sets landing_page_type
     *
     * @param \AmazonAdvertisingApi\Model\LandingPageType $landing_page_type landing_page_type
     *
     * @return $this
     */
    public function setLandingPageType($landing_page_type)
    {
        $this->container['landing_page_type'] = $landing_page_type;

        return $this;
    }

    /**
     * Gets ad_name
     *
     * @return \AmazonAdvertisingApi\Model\AdName
     */
    public function getAdName()
    {
        return $this->container['ad_name'];
    }

    /**
     * Sets ad_name
     *
     * @param \AmazonAdvertisingApi\Model\AdName $ad_name ad_name
     *
     * @return $this
     */
    public function setAdName($ad_name)
    {
        $this->container['ad_name'] = $ad_name;

        return $this;
    }

    /**
     * Gets is_mobile
     *
     * @return bool
     */
    public function getIsMobile()
    {
        return $this->container['is_mobile'];
    }

    /**
     * Sets is_mobile
     *
     * @param bool $is_mobile Preview the creative as if it is on a mobile environment.
     *
     * @return $this
     */
    public function setIsMobile($is_mobile)
    {
        $this->container['is_mobile'] = $is_mobile;

        return $this;
    }

    /**
     * Gets is_on_amazon
     *
     * @return bool
     */
    public function getIsOnAmazon()
    {
        return $this->container['is_on_amazon'];
    }

    /**
     * Sets is_on_amazon
     *
     * @param bool $is_on_amazon Preview the creative as if it is on an amazon site or third party site. The main difference is whether the preview will contain an AdChoices icon.
     *
     * @return $this
     */
    public function setIsOnAmazon($is_on_amazon)
    {
        $this->container['is_on_amazon'] = $is_on_amazon;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
